﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBeamLibrary.VehicleParts.Elements;

namespace JBeamLibrary.Events
{
    public class ElementPropertyChangedEventArgs : PropertyChangedEventArgs
    {
        #region Properties

        /// <summary>Gets the vehicle element</summary>
        public VehicleElement Element { get; private set; }

        /// <summary>Gets the previous value</summary>
        public object OldValue { get; private set; }

        /// <summary>Gets the new value</summary>
        public object NewValue { get; private set; }

        #endregion

        #region CTORs

        public ElementPropertyChangedEventArgs(VehicleElement element, string propertyName, object oldValue, object newValue)
            : base(propertyName)
        {
            Element = element;
            OldValue = oldValue;
            NewValue = newValue;
        }

        #endregion

        #region Overrides

        public override string ToString()
        {
            return string.Format("{0} > {1}: {2} => {3}", Element, PropertyName, OldValue, NewValue);
        }

        #endregion
    }

    public delegate void ElementPropertyChangedEventHandler(object sender, ElementPropertyChangedEventArgs e);
}
